<?php
	$css_list[0]['url'] = './tpl/css/setting.css';
	$js_list[0] = './public/js/city.js';
?>
<!--{template inc/header_n}-->
<div id="body" class="fm960">
	<div class="piece1">
		<div class="piece1_hd"></div>
		<div class="piece1_bd clearfix">
			<div style="width:1180px;">
				<!--{template inc/settings/settings_menu}-->
				<div id="setting_box" class="fl">
					<div id="setting_form" class="setting_basic">
						<form id="myform" action="{u shareinfo/saveart}" method="post" name="saveart" enctype="multipart/form-data">
							<dl>
							    {if !$_GET['jiage']}
							    {if $_FANWE['uid'] == 1}
								<dd>uid：</dd>
								<dt class="email">
									<input name="uid" type="text" style="height: 24px;width: 200px;" />
								</dt>
								{/if}
								<dd>标题：</dd>
								<dt class="email">
									<input id="title" name="title" type="text" value="{$article['title']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>*</span></div>
								</dt>
								{if $anli}
								<dd>店铺名称：</dd>
								<dt class="email">
								    {if !empty($article)}{$article['shop_name']}{elseif $anli}{$shopinfo['name']}{/if}
									<input name="shop_name" type="hidden" value="{if !empty($article)}{$article['shop_name']}{elseif $anli}{$shopinfo['name']}{/if}" />
								</dt>
								<dd>店铺区域：</dd>
								<dt class="location">
									<select id="province" name="province">
									</select>
									&nbsp;&nbsp;
									<select id="city" name="city">
									</select>
									<input type="hidden" id="provincename" name="provincename"/>
									<input type="hidden" id="cityname" name="cityname"/>
								</dt>
								<dd>价格：</dd>
								<dt class="email">
									<input id="price" name="price" type="text" value="{$article['price']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>*</span></div>
								</dt>
								<dd>折扣价：</dd>
								<dt class="email">
									<input id="price2" name="price2" type="text" value="{$article['price2']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>选填</span></div>
								</dt>
                                <dd>红包金额：</dd>
                                <dt class="email">
                                    <input id="red_money" name="red_money" type="text" value="{$article['red_money']}" style="height: 24px;width: 200px;" />
                                    <div class="iner"><span>选填,默认不赠送红包</span></div>
                                </dt>
								<dd>开始时间：</dd>
								<dt class="email">
									<input id="bsj" onClick="WdatePicker()" readonly="true" name="bsj" type="text" value="{$article['bsj']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>选填</span></div>
								</dt>
								<dd>结束时间：</dd>
								<dt class="email">
									<input id="esj" onClick="WdatePicker()" readonly="true" name="esj" type="text" value="{$article['esj']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>选填</span></div>
								</dt>
								{/if}
								<dd>所属分类：</dd>
								<dt class="unick">
								    {if empty($article)}
									<select id="pcate" onchange="showcate(this.value)">
									    {loop $cate_list $v}
									    <option value="{$v['cate_id']}"{if $article['cate_id']==$v['cate_id']} selected{/if}>{$v['cate_name']}</option>
									    {/loop}
									</select>
									<span id="cate_wrap"></span>
									{else}
									{$cate_name}*
									{/if}
								</dt>
								<dd>封面：</dd>
								<dt class="email">
									<input name="img" type="file" />
									{if !empty($article['img'])}<p><img src="{$article['img']}" width="150"/></p>{/if}
									<div class="iner"><span>*</span>宽高最小257px最大600px</div>
								</dt>
								<dd>内容：</dd>
								<dt class="unick">
                                    <script type="text/plain" id="content" name="content"></script>
								</dt>
								{else}
								<dd>价格：</dd>
								<dt class="email">
									<input id="price" name="price" type="text" value="{$article['price']}" style="height: 24px;width: 200px;" />
									<div class="iner"><span>*</span></div>
								</dt>
								<dd>描述：</dd>
								<dt class="unick">
                                    <script type="text/plain" id="content" name="content"></script>
								</dt>
								{/if}
								<dd>&nbsp;&nbsp;</dd>
								<dt>
									<input class="green_button" type="submit" value="确定">
								</dt>
							</dl>
							{if $id}<input type="hidden" name="id" value="{$id}"/>{/if}
							{if $_GET['anli']}
							<input type="hidden" name="anli" value="1"/>
							{elseif $_GET['jiage']}
							<input type="hidden" name="jiage" value="1"/>
							{/if}
						</form>
					</div>
				</div>
			</div>
		</div>
		<div class="piece1_ft"></div>
	</div>
	
	<div class="huoguojun2" id="huoguojun"><a href="/list.php?action=robot"><img src="/public/v1/img/huoguojun.png"></a></div>
    <div class="i_notice2">
        <div class="j_title">公告栏</div>
        <div class="j_list">
            <ul>
                <li><a href="#"><span style="color:red;">泡泡火锅加盟,提供个大卫视广告宣传</span></a></li>
                <li><a href="#">火锅怎么做才好吃?</a></li>
                <li><a href="#">谁能给我一份火锅配菜全谱?</a></li>
                <li><a href="#">火锅一般而言,是以锅为器具</a></li>
                <li><a href="#">泡泡火锅加盟,提供个大卫视广告宣传</a></li>
                <li><a href="#">火锅怎么做才好吃?</a></li>
                <li><a href="#">谁能给我一份火锅配菜全谱?</a></li>
                <li><a href="#">火锅一般而言,是以锅为器具</a></li>
            </ul>
        </div>
    </div>
</div>
<script type="text/javascript" charset="utf-8" src="/public/js/ueditor1_4_3-utf8-php/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/js/ueditor1_4_3-utf8-php/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
jQuery(function($){
	<!--{if empty($_FANWE['user']['introduce'])}-->
	$("#introduce").one('focus',function(){
		this.value = '';
	});
	<!--{/if}-->
	$.Bind_City("#province","#city","{if !empty($article)}{$article['province']}{elseif !empty($shopinfo)}{$shopinfo['province']}{else}{$_FANWE['user']['reside_province']}{/if}","{if !empty($article)}{$article['province']}{elseif !empty($shopinfo)}{$shopinfo['city']}{else}{$_FANWE['user']['reside_city']}{/if}");
});

var editor = UE.getEditor('content',{
    //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
    toolbars:[['FullScreen', 'Undo', 'Redo','Bold',{if $anli == 1 && $_FANWE['uid']==1}'link', 'unlink',{/if}'simpleupload','preview']],
    //focus时自动清空初始化时的内容
    autoClearinitialContent:true,
    //关闭字数统计
    wordCount:false,
    //关闭elementPath
    elementPathEnabled:false,
    //默认的编辑区域高度
    initialFrameHeight:200,
    initialFrameWidth:500,
    //更多其他参数，请参考ueditor.config.js中的配置项
    serverUrl: '/public/js/ueditor1_4_3-utf8-php/php/controller.php'
});
editor.ready(function(){
    this.setContent('{$article['content']}');
});

function resetform() {
    $('#title').val('');
    $('#price').val('');
    $('#price2').val('');
    editor.setContent('');
}

$('#myform').submit(function(){
    {if $anli}
    $('#provincename').val($('#province option:selected')[0].innerHTML);
    $('#cityname').val($('#city option:selected')[0].innerHTML);
    {/if}
    $(this).ajaxSubmit({
        //dataType: "json",
        beforeSubmit: function(a,f,o) {

        },
        success: function(s) {
        	alert(s);
        	if(s == '{if $anli == 1}案例{elseif $_GET['jiage']}价格{else}经验{/if}提交成功！') {
        	    {if $_FANWE['uid'] == 1}
        	    {if !$article}
        	    resetform();
        	    {/if}
        	    {else}
        		location.href = '/shareinfo.php?action=listart{if $anli == 1}&anli=1{elseif $_GET['jiage']}&jiage=1{/if}';
        		{/if}
        	}
        },
        error: function() {}
    });
    return false;
});

{if !$_GET['jiage']}
function showcate(pid) {
	$.get('/shareinfo.php?action=getcate&anli={$anli}&pid='+pid,function(s) {
		$('#cate_wrap').html(s);
	});
}
showcate($('#pcate').val());
{/if}
</script>
<!--{template inc/footer}-->